home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / unixSyscall / utimes.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-25  |  1.6 KB  |  62 lines

  1. /* 
  2.  * utimes.c --
  3.  *
  4.  *    Procedure to map from Unix utimes system call to Sprite system call.
  5.  *
  6.  * Copyright 1986 Regents of the University of California
  7.  * All rights reserved.
  8.  */
  9.  
  10. #ifndef lint
  11. static char rcsid[] = "$Header: utimes.c,v 1.2 88/08/25 14:41:12 brent Exp $ SPRITE (Berkeley)";
  12. #endif not lint
  13.  
  14. #include "sprite.h"
  15. #include "fs.h"
  16.  
  17. #include "compatInt.h"
  18. #include <errno.h>
  19. #include <sys/time.h>
  20.  
  21.  
  22. /*
  23.  *----------------------------------------------------------------------
  24.  *
  25.  * utimes --
  26.  *
  27.  *    Procedure to map from Unix utimes system call to Sprite 
  28.  *    Fs_SetAttributes system call.
  29.  *
  30.  * Results:
  31.  *      UNIX_SUCCESS    - the call was successful.
  32.  *      UNIX_ERROR      - the call was not successful.
  33.  *                        The actual error code stored in errno.
  34.  *
  35.  * Side effects:
  36.  *    The protection of the specified file is modified.
  37.  *
  38.  *----------------------------------------------------------------------
  39.  */
  40.  
  41. int
  42. utimes(path, tvp)
  43.     char *path;
  44.     struct timeval tvp[2];
  45. {
  46.     ReturnStatus status;    /* result returned by Sprite system calls */
  47.     Fs_Attributes attributes;    /* struct containing all file attributes,
  48.                  * only access/modify times looked at. */
  49.  
  50.     attributes.accessTime.seconds = tvp[0].tv_sec;
  51.     attributes.accessTime.microseconds = tvp[0].tv_usec;
  52.     attributes.dataModifyTime.seconds = tvp[1].tv_sec;
  53.     attributes.dataModifyTime.microseconds = tvp[1].tv_usec;
  54.     status = Fs_SetAttr(path,  FS_ATTRIB_FILE, &attributes, FS_SET_TIMES);
  55.     if (status != SUCCESS) {
  56.     errno = Compat_MapCode(status);
  57.     return(UNIX_ERROR);
  58.     } else {
  59.     return(UNIX_SUCCESS);
  60.     }
  61. }
  62.